package com.liaogui.event.service.impl;

import com.liaogui.event.event.OrderStatusEvent;
import com.liaogui.event.handler.OrderStatusEventHandler;
import com.liaogui.event.service.IOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author liaogui
 * @date 2025/2/9 15:55
 */
@Slf4j
@RequiredArgsConstructor
@Component
public class OrderServiceImpl implements IOrderService {
    private final OrderStatusEventHandler orderStatusEventHandler;
    @EventListener
    public void statusHandler(OrderStatusEvent orderStatusEvent) {
        log.info("OrderServiceImpl statusHandler 当前任务执行:{}", orderStatusEvent);
    }

    @Override
    public void order() {
        // 订单校验逻辑

        // 下订单

        // 订单状态监听
        orderStatusEventHandler.statusHandler("2025020916141023", "success");
    }
}
